package com.zhimu.boot.activemq.topic.consumer;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.TextMessage;

/**
 * @Author: Alvin
 * @Date: 2019/6/23 17:11
 * @Description
 */
@Component
public class Topic_Consumer {

    @JmsListener(destination = "${myTopic}")
    public void receive(TextMessage textMessage){
        try {
            System.out.println("订阅者接收到主题信息：" + textMessage.getText());
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }

}
